﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Bson.Serialization;
using Jint.Native;
using MongoDB.Bson.IO;

namespace jsweb
{
   public class BsonJsonSerializer : IBsonSerializer
   {
      public object Deserialize(MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)
      {
         throw new NotImplementedException();
      }

      public object Deserialize(MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)
      {
         throw new NotImplementedException();
      }

      public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)
      {
         throw new NotImplementedException();
      }

      public void Serialize(MongoDB.Bson.IO.BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
      {
         bsonWriter.WriteStartDocument();
         JsonSerializer.Serialize(value as JsObject, bsonWriter);
         bsonWriter.WriteEndDocument();
      }

      public void SetDocumentId(object document, object id)
      {
         throw new NotImplementedException();
      }
   }
}
